package com.itheima.service.Impl;

import com.itheima.pojo.Bounty;
import com.itheima.pojo.BountyUserParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.itheima.service.BountyService;
import com.itheima.mapper.BountyMapper;

import java.util.List;

@Service
public class bountyServiceImpl implements BountyService {
    @Autowired
    public BountyMapper bountyMapper;
    /**
     * 查询悬赏任务列表
     * @return
     */
    @Override
    public List<Bounty> list() {
     List<Bounty> paramList = bountyMapper.list();
     return paramList;
    }

    /**
     *
     * @param bup
     */
    @Override
    public void acceptBounty(BountyUserParam bup) {
        bountyMapper.addUB(bup);
    }

    /**
     * 删除悬赏任务
     * @param id
     */
    @Override
    public void delete(Integer id) {
        bountyMapper.delete(id);
    }


    /**
     * 添加悬赏任务
     * @param bounty
     */
    @Override
    public void add(Bounty bounty) {
        bountyMapper.add(bounty);
    }

    @Override
    public Bounty getbosById(Integer id) {
        Bounty bounty =bountyMapper.getbosById(id);
        return  bounty;
    }

    @Override
    public void update(Bounty bounty) {
        bountyMapper.update(bounty);
    }
}
